
import {getAndCommit , postAndCommit} from '@/api/https'
import { arrToObj, objToArr } from '../../../hooks/help'
import { types } from '../types'
const state = {
    houseList: [1,2,3]
}

const mutations = {
    [types.GET_HOUSELIST](state, data) {
        state.houseList = data.data
    }
}

const actions = {
    houseList({ commit } ,payload) {
        return getAndCommit('houseList',payload,commit)
    },
    newsList({ commit } ,payload) {
        return getAndCommit('api/getArticle',payload,commit)
    }
    ,
    houseDetail({ commit } ,payload) {
        return getAndCommit('house',payload,commit)
    }
}

const getters = {
    getHouseList: (state) => {
        return objToArr(state.houseList)
    }
}

export default {
  namespaced: true, //命名空间
  state,mutations,getters,actions
}
